<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
        .tab {
            width: 500px;
            height: 300px;
            /* border: 1px solid #000; */
            margin: 100px auto;
        }
        .top{
            display: flex;          
        }
        .top div {
            width: 100px;
            height: 50px;
            background-color:#ccc;
            line-height: 50px;
            text-align: center;
            margin-right: 5px;
        }
        .top div.active{
            background-color: yellow;
        }
        #box{
            width: 500px;
            height: 250px;
            background-color: yellow;
            display: none;
        }

        #box.current{
            display: block;
        }
    </style>
</head>

<body>
    <!-- 这个div标签是交给vue去管理的 -->
    <div id="app">
        <div class="tab">
            <div class="top">
                <div :class="num==1?'active':''" @click="num=1">tab一</div>
                <div :class="num==2?'active':''" @click="num=2">tab二</div>
                <div :class="num==3?'active':''" @click="num=3">tab三</div>
            </div>
            <div id="box" :class="num==1?'current':''">tab一</div>
            <div id="box" :class="num==2?'current':''">tab二</div>
            <div id="box" :class="num==3?'current':''">tab三</div>

        </div>

    </div>
    <script>
        //vue代码始于一个vue对象
        new Vue({
            el: '#app',
            data: {
                num:1,
            }
        })
    </script>
</body>

</html>